<%@ page import="pe.com.mowa.siscobsms.datos.*" %>
<%@ page import="pe.com.mowa.siscobsms.bean.persona" %>
<%@ page import="pe.com.mowa.siscobsms.bean.analista" %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html >
<head>

<script>
function vacio(q) {  
        for ( i = 0; i < q.length; i++ ) {  
                if ( q.charAt(i) != " " ) {  
                        return true  ;
                }  
        }  
        return false  
}  

function validaMnEntre(campo) {  
          
        if(vacio(campo.value) == false ) {  
                return false;  
        } else {  
                return true ; 
        }  
          
}  
function validaVacios()
{
    if (document.getElementById("local").value=='-1')
    {
    alert('Debe seleccionar un local');
    return; 
    }
	if (!validaMnEntre(document.getElementById("txtNombre")))
	{
	alert('Debe ingresar nombre');
	return;
	}
	if (!validaMnEntre(document.getElementById("txtapePat")))
	{
	alert('Debe ingresar apellido paterno');
	return;
	}

}

function setPersona()
{
/*
    if (document.getElementById("local").value=='-1')
    {
    alert('Debe seleccionar un local');
    return; 
    }
	if (!validaMnEntre(document.getElementById("txtNombre")))
	{
	alert('Debe ingresar nombre');
	return;
	}
	if (!validaMnEntre(document.getElementById("txtapePat")))
	{
	alert('Debe ingresar apellido paterno');
	return;
	}
	*/
	document.getElementById("frmRegPersona").action="setPersona";
	document.getElementById("frmRegPersona").submit();
	
	}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registro de persona</title>
</head>

<body>

<form method="post" id="frmRegPersona">
  <table width="450" border="0">
    <tr>
      <td colspan="10"><CENTER>
          REGISTRO DE PERSONA
      </CENTER></td>
    </tr>
    <tr>
      <td width="4">&nbsp;</td>
      <td width="13">&nbsp;</td>
      <td width="52">&nbsp;</td>
      <td width="85">&nbsp;</td>
      <td width="82">&nbsp;</td>
      <td width="113">&nbsp;</td>
      <td width="13">&nbsp;</td>
      <td width="13">&nbsp;</td>
      <td width="13">&nbsp;</td>
      <td width="20">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Nombres</td>
      <td><input type="text" name="txtNombre" /></td>
      <td>Apellido Paterno</td>
      <td><input type="text" name="txtapePat" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Apellido Materno</td>
      <td><input type="text" name="txtapeMat" /></td>
      <td>Local</td>
      <td>
      <select name="local" id="local">
	  <option value='-1'> - </option>
		<%
			conAnalista cl = new conAnalista();
				ArrayList locales= cl.getLocales();
				String nomLoc;
				String idLoc;
				String dirLoc;
				analista loc;
				
				     		for (int i = 0; i < locales.size(); i++) {
				     		loc=(analista) locales.get(i); 
				     		idLoc=String.valueOf(loc.getId());
				     		nomLoc=loc.getNombre();
				     		dirLoc= loc.getDireccion();
				     		
				     		idLoc = String.valueOf(loc.getId());
			out.print("<option value='"+idLoc+"'>"+nomLoc+" / "+dirLoc+"</option>");
			}
		%>
                </select>      </td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>

    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Domicilio</td>
      <td colspan="3"><textarea name="txtDireccion" cols="45" rows="3"></textarea></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Telefono1</td>
      <td><input type="text" name="txtTelefono1" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Telefono2</td>
      <td><input type="text" name="txtTelefono2" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
</table>
</form>

<table>
  <tr>
    <td width="25%">&nbsp;</td>
    <td width="25%"><input type="button" name="btnCancelar" value="Cancelar"  /></td>
    <td width="25%"><input type="button" name="btnGrabar" value="Grabar" onClick="setPersona();" /></td>
    <td width="25%">&nbsp;</td>
  </tr>
</table>

    

</body>
</html>
